<template>
	<view>
		<view class="wrap">
			<view class="submit" @click="jump('/pages/college/active-submit')">报名最新活动</view>
			
			<view class="title">往期精彩</view>
			<view class="card" v-for="(item,index) in list" :key="item.id" @click="jump('/pages/college/active-detail?id='+item.id)">
				<view class="type">{{item.title}}</view>
				<image :src="item.cover"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"college-active",
		data() {
			return {
				page:1,
				list:[],
				status:'loading',
			};
		},
		methods:{
			getList(){
				this.status = 'loading'
				this.$u.api.activity({
					state:2,
					page:this.page,
					limit:10
				}).then(data=>{
					let res = data.data
					this.list = this.page == 1 ? res : this.list.concat(res)
					this.status = res.length  === 10 ? 'loadmore' : 'nomore'
					uni.stopPullDownRefresh()
				})
			},
			reachBottom(){
				if(this.status == 'loadmore'){
					this.page ++
					this.getList()
				}
			}
		},
		created() {
			this.getList()
		}
	}
</script>

<style lang="scss">
	.wrap{
		padding: 40rpx 60rpx 30rpx;
		.submit{background-color: $tc;color: #fff;font-size: 36rpx;font-weight: bold;text-align: center;line-height: 88rpx;border-radius: 100rpx;}
		.title{font-size: 32rpx;font-weight: bold;padding: 40rpx 0 24rpx;}
		.card{
			position: relative;margin-top: 20rpx;
			&:first-child{margin-top: 0;}
			
			image{width: 100%;height: 280rpx;border-radius: 20rpx;display: block;}
			.type{position: absolute;left: 0;background-color: rgba($color: #000, $alpha: .4);border-radius: 0 50rpx 50rpx 0;padding: 4rpx 20rpx 4rpx 14rpx;color: #fff;top: 20rpx;}
		}
		
	}
</style>
